<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文件管理工具</title>
</head>
<body>
    <h1>文件管理工具</h1>
    {% with messages = get_flashed_messages() %}
        {% if messages %}
            <ul>
            {% for message in messages %}
                <li>{{ message }}</li>
            {% endfor %}
            </ul>
        {% endif %}
    {% endwith %}
    <h2>上传文件</h2>
    <form method="post" enctype="multipart/form-data">
        {{ form.hidden_tag() }}
        {{ form.file.label }} {{ form.file() }}<br>
        {{ form.submit() }}
    </form>
    <h2>已上传的文件</h2>
    <ul>
    {% for file in files %}
        <li>
            {{ file }} 
            <a href="{{ url_for('view_file', filename=file) }}">查看</a>
            <a href="{{ url_for('download_file', filename=file) }}">下载</a>
            <a href="{{ url_for('delete_file', filename=file) }}">删除</a>
        </li>
    {% endfor %}
    </ul>
</body>
</html>
